# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Anatol Pomozov

pkgname=python-txaio
# https://github.com/crossbario/txaio/blob/master/docs/releases.rst
pkgver=23.1.1
pkgrel=2
pkgdesc='Compatibility API between asyncio/Twisted/Trollius'
arch=('any')
url="https://github.com/crossbario/txaio"
license=('MIT')
depends=('python-six')
makedepends=('python-setuptools')
# python-tests is used here:
# https://github.com/crossbario/txaio/blob/v20.1.1/test/_asyncio_test_utils.py#L35
checkdepends=('python-pytest' 'python-twisted' 'python-tests')
source=("https://pypi.io/packages/source/t/txaio/txaio-$pkgver.tar.gz")
sha512sums=('41320501ec3e2555edc63326f2c5ee9bbc2fd103198a515b6dc4c44603a41d633c99a8f12c92ffc85f43546f0382d40f0c9748b13f7a7e70d98c5c4a2de85e2e')

prepare() {
  # This tests whether pip can install the sdist, and is completely broken
  # except in their boutique setup. They won't fix it.
  # https://github.com/crossbario/txaio/issues/77#issuecomment-246276723
  rm txaio-$pkgver/test/test_packaging.py
}

build() {
  cd "$srcdir"/txaio-$pkgver
  python setup.py build
}

check() {
  cd "$srcdir"/txaio-$pkgver
  python -m pytest
}

package() {
  cd txaio-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
